<?php

/*
To test uncomment below code and comment line no. 29,30,31,4 & 47.
$username = 'username';
$password = 'password';

$roleID = '1';
$empID = '1';
$dateID = '7';
$startTime = '12';
$endTime = '12';
$shiftStatus = 'Occupied';

$a = array();
array_push($a, $roleID);
array_push($a, $empID);
array_push($a, $dateID);
array_push($a, $startTime);
array_push($a, $endTime);
array_push($a, $shiftStatus);


$result = addShift($username,$password,$a);
echo(json_encode($result));*/

function addShift($authUser, $authUserPass, $arrayOfData)
{
      if (checkAuthorization($authUser, $authUserPass) != true){
        return array(ErrorCode::authFailRead);
      }

      $conn = mysql_connect('localhost','root','');
      mysql_select_db('paradigmShift_DEV');

      if(!$conn)
      {
            die('Could not connect: ' . mysql_error());
            return array(ErrorCode::sysError);
      }

      $sql = "insert into roledates values('".$arrayOfData[0]."','".$arrayOfData[1]."','".$arrayOfData[2]."','".$arrayOfData[3]."','".$arrayOfData[4]."','".$arrayOfData[5]."')";

      if (mysql_query($sql)){
            return array('ErrorCode::successUpdate');
      } else {
            return array('ErrorCode::failDelete');
      }
      mysql_close($conn);
}
?>
